import java.io.File;
import java.io.FileFilter;
import java.io.IOException;

public class FileDemo {
    public static void main(String[] args) throws Exception {
      /*  File dir =new File("D://hehe/haha");
//        file.createNewFile();
        boolean b = dir.mkdirs();
        System.out.println(b);
        File file = new File(dir, "mygood");
       // file.createNewFile();
        file.mkdir();
        boolean isFile = file.isFile();
        System.out.println(isFile);*/

        String path = "C:\\code\\core_java";
        File dir = new File(path);


        File[] listFiles = dir.listFiles(file -> file.isFile());
        String name4Find = "README.md";
        boolean exits = false;
        for (File file : listFiles) {
            if(file.getName().equals(name4Find)){
                exits = true;
                break;
            }
        }
        System.out.println(exits?"OK":"NO!");

        /*  File[] files = dir.listFiles(file -> file.isFile() && file.getName().equals("README.md"));
        System.out.println(files.length>0?"OK":"NO");*/

    }
}
